﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Xml;
using SurveySystem.Model;
using System.Windows.Media;

namespace SurveySystem.Repository
{
    public class TestRepository : ISurveyRepository
    {
        /// <summary>
        /// Default constructor
        /// </summary>
        public TestRepository() { }

        public Survey GetSurveyByID(int surveyID)
        {
            var answers1 = new List<Answer>()
            {
                new Answer() { QuestionID = 0, AnswerID = 0, AnswerText = "Computer Science" },
                new Answer() { QuestionID = 0, AnswerID = 0, AnswerText = "Software Engineering" },
                new Answer() { QuestionID = 0, AnswerID = 0, AnswerText = "Information Systems" },
                new Answer() { QuestionID = 0, AnswerID = 0, AnswerText = "Curtain Hanging" },
            };

            var answers2 = new List<Answer>()
            {
                new Answer() { QuestionID = 1, AnswerID = 0, AnswerText = "Fish" },
                new Answer() { QuestionID = 1, AnswerID = 0, AnswerText = "Haggis" },
                new Answer() { QuestionID = 1, AnswerID = 0, AnswerText = "Yorkshire puddings" },
                new Answer() { QuestionID = 1, AnswerID = 0, AnswerText = "Potatoes" },
            };

            var questions = new List<Question>()
            {
                new Question() { QuestionID = 0, QuestionNumber = 1, QuestionText = "What is the best University course?", PossibleAnswers = answers1 },
                new Question() { QuestionID = 1, QuestionNumber = 2, QuestionText = "What is your favourite food?", PossibleAnswers = answers2 },
            };

            Survey s = new Survey()
            {
                SurveyID = 0,
                BackgroundColor = Colors.Blue,
                ForegroundColor = Colors.White,
                Closed = false,
                CloseDate = DateTime.Now.AddDays(5),
                OpenDate = DateTime.Now.AddDays(-2),
                Owner = "MEng Software Engineering 5",
                Description = "A simple test survey",
                MoreInfoUrl = "http://groups.google.com/group/hw-macs-interactive-displays",
                Title = "MEng Software Engineering 5 Survey"
            };
            s.Questions.AddRange(questions);

            return s;
        }

        public List<Survey> GetAllActiveSurveys()
        {

            List<Survey> list = new List<Survey>();

            list.Add(GetSurveyByID(0));

            return list;

        }

        public List<Survey> GetAllSurveys()
        {
            List<Survey> list = new List<Survey>();

            list.Add(GetSurveyByID(0));

            return list;

        }
        
        public void AddSurvey(Survey s)
        {
            throw new NotImplementedException();
        }

        public void UpdateSurvey(Survey s)
        {
            throw new NotImplementedException();
        }

        public void DeleteSurvey(int surveyID)
        {
            throw new NotImplementedException();
        }

    }
}
